package com.solidtrust.admin.service;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Service;


@Service
public class PriceService {

	@PersistenceContext EntityManager em;
	
	@Deprecated
	public List<String> getCategories(String brand, String model, Integer level){
		String ql = null;
		if(level == 0){
			ql = "select distinct brand from Che168 c where c.brand is not null order by brand";
		}
		else if(level == 1){
			ql = "select distinct model from Che168 c where c.model is not null and c.brand = '" + brand + "' order by model";
		}
		else if(level == 2){
			ql = "select distinct build from Che168 c where c.build is not null and c.brand = '" + brand + "' and c.model = '" + model + "' order by build";
		}
		
		return em.createQuery(ql, String.class).getResultList();
	}
	
}
